<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="<?=JS_PATH?>jquery.min.js"></script>
    <script type="text/javascript" src="<?=ASSETS?>layer/layer.js"></script>
    <link href="<?=ASSETS?>time/css/foundation-datepicker.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="<?=ASSETS?>bootstrap/bootstrap.min.css" />
    <title>文章列表</title>
</head>
<script>


    function show_err()
    {

        <?php if(!empty($error_message)):  ?>
        layer.msg("<?=$error_message?>");
        <?php endif; ?>
    }
    show_err();



    $(function(){


        //验证密码
        function check_password_formmat($val){
            var str=/^[0-9_a-zA-Z]{6,10}$/;

            if($val==""){
                throw new Error("请输入密码");
            }
            else{
                if(!str.test($val)){
                    throw new Error("密码格式错误");
                }
            }
        }

        //验证两次密码是否相等

        function check_confirm_password($pass_word,$confirm_password)
        {
            if($pass_word!=$confirm_password)
                throw new Error("密码输入不一致!");

        }
        $("#reset_psw").click(function()
        {

            try
            {
                var old_password= $("#old_password").val();
                var password = $("#password").val();
                var confirm_password = $("#confirm_password").val();
                check_password_formmat(old_password);
                check_password_formmat(password);
                check_confirm_password(password,confirm_password);
                $("#safe_form").submit();
            }
            catch(e)
            {
                layer.msg(e.message);
            }

        });

    });


</script>
<body>
<div class="container col-lg-8 col-lg-offset-2" style="margin-top: 3%">

        <div class="row">

             <form id="safe_form" class="form" method="post">


                 <div class="form-group form-inline">
                     <label>重置密码</label>
                     <hr style="margin: 0px 0px 10px 0px;"/>

                 </div>

                 <div class="form-group form-horizontal col-lg-5 col-lg-offset-3 input-group-sm">

                     <label>原密码</label>
                     <input id="old_password" name="old_password" type="password" class="form-control"/>
                     <label>新密码</label>
                     <input id="password"  name="password" type="password" class="form-control"/>
                     <label>确认密码</label>
                     <input id="confirm_password" name="confirm_password" type="password" class="form-control"/>

                 </div>
                 <div class="form-group col-lg-5 col-lg-offset-3">

                     <button type="button" id="reset_psw" class="btn btn-primary col-lg-offset-3 btn-sm">重置密码</button>
                     <button  type="reset" class="btn btn-danger col-lg-offset-1 btn-sm">清空信息</button>
                 </div>

             </form>

        </div>

</div>

</body>
</html>
